package storyteller;

public class Main
{
  
  public static StringBuilder Logger = new StringBuilder();
  
  
  public static void main (String [] args)
  {
    if (args.length < 2)
    {
      println("Usage: java -jar flashtext.jar input.ft output.swf <flash|smil>");
      return;
    }
     
    String inputFilename = args[0];
    String outputFilename = args[1];
    String type = "flash";
    if (args.length >= 3)
    {
      type = args[2];
    }
    
    if ("flash".equals(type))
    {
      FlashWriter writer = new FlashWriter(outputFilename);
      writer.parse(inputFilename);
      writer.save();
    }
    else if ("smil".equals(type))
    {
      SmilWriter writer = new SmilWriter(outputFilename);
      writer.parse(inputFilename);
      writer.save();
    }
    else
    {
      println("Unknown media type ["+ type + "], only [flash] or [smil] accepted");
      return;
    }
    println("File " + outputFilename + " generated. Enjoy.");
  }
  
  private static void println(String message)
  {
    Logger.append(message);
    System.out.println(message);
  }
}
